package kr.hkit.powerjava.algorithm;

public class ListStack {
	private Item top;

	public void push(Item i) {
		i.setLink(top);
		top=i;
	}

	public Item pop() {
		Item i;
		i = top;
		top=top.getLink();
		return i;
	}

	public void prnListStack() {
		Item temp = top;
		while (temp != null) {
			System.out.println(temp.getData());
			temp=temp.getLink();
		}
	}
}
